using System;
using System.Data;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Cratos.Tools.General;
using Cratos.Tools.DataObject;

namespace Cratos.Generator.DataObject
{
	/// <summary>
	/// Project Object class
	/// </summary>
	[Serializable]
	[DOCratos("Cratos Project")]
	[DOCratosAction(DOCratosAction.Retrieve,	DOCratosActionType.StoredProcedure, true,		"spCratosProject_Retrieve")]
	[DOCratosAction(DOCratosAction.Create,		DOCratosActionType.StoredProcedure, true,		"spCratosProject_Create")]
	[DOCratosAction(DOCratosAction.Update,		DOCratosActionType.StoredProcedure, false,	"spCratosProject_Update")]
	[DOCratosAction(DOCratosAction.Delete,		DOCratosActionType.StoredProcedure, false,	"spCratosProject_Delete")]
	public partial class DOCratosProject : DOCratos, IDOCratos
	{
		#region Class Constant declarations
		/// <summary>
		/// Project Column
		/// </summary>
		public const string DBIdColumn = "CratosProject_ID";

		/// <summary>
		/// Project Column
		/// </summary>
		public const string DBNameColumn = "CratosProject_Name";

		/// <summary>
		/// Project Column
		/// </summary>
		public const string DBDateColumn = "CratosProject_Date";

		/// <summary>
		/// Project Column
		/// </summary>
		public const string DBIsActiveColumn = "CratosProject_IsActive";
		#endregion

		#region Class Event declarations
		#endregion

		#region Class Variable declarations
		#region DO Variables
		private long			 m_ID;
		private string		 m_Name;
		private DateTime	 m_Date;
		private bool			 m_IsActive;
		#endregion

		#region Embedded Object Variables
		private DOCratosModuleCollection m_ModuleCollection;
		#endregion
		#endregion

		#region Class Constructors & Destructors
		/// <summary>
		/// Class Constructor
		/// </summary>
		public DOCratosProject() : base()
		{
			// Set the relevant CRUD Action indicators
			this.CanCreate		= true;
			this.CanRetrieve	= true;
			this.CanUpdate		= true;
			this.CanDelete		= true;
		}
		#endregion

		#region Class Properties
		#region DO Properties
		/// <summary>
		/// ID
		/// </summary>
		[DOCratosColumn("Id", "Id", DbType.Int64, DOCratosProject.DBIdColumn, 0, IsKey = true)]
		[DOCratosActionColumn(DOCratosAction.Retrieve, true)]
		[DOCratosActionColumn(DOCratosAction.Update, true)]
		[DOCratosActionColumn(DOCratosAction.Delete, true)]
		public long Id
		{
			get { return(this.m_ID); }
			set { this.m_ID = value; this.NotifyPropertyChanged("Id"); }
		}

		/// <summary>
		/// Name
		/// </summary>
		[DOCratosColumn("Name", "Name", DbType.String, DOCratosProject.DBNameColumn, "")]
		[DOCratosActionColumn(DOCratosAction.Create, true)]
		[DOCratosActionColumn(DOCratosAction.Update, true)]
		public string Name
		{
			get { return(this.m_Name); }
			set { this.m_Name = value; this.NotifyPropertyChanged("Name"); }
		}

		/// <summary>
		/// Date
		/// </summary>
		[DOCratosColumn("Date", "Date", DbType.DateTime, DOCratosProject.DBDateColumn)]
		[DOCratosActionColumn(DOCratosAction.Create, true)]
		public DateTime Date
		{
			get { return(this.m_Date); }
			set { this.m_Date = value; this.NotifyPropertyChanged("Date"); }
		}

		/// <summary>
		/// IsActive
		/// </summary>
		[DOCratosColumn("IsActive", "IsActive", DbType.Boolean, DOCratosProject.DBIsActiveColumn, true)]
		public bool IsActive
		{
			get { return(this.m_IsActive); }
			set { this.m_IsActive = value; this.NotifyPropertyChanged("IsActive"); }
		}
		#endregion

		#region Embbedded Object Properties
		/// <summary>
		/// Cratos Modules
		/// </summary>
		[DOCratosEmbedded("Modules", "Modules", true, IsCollection = true)]
		[DOCratosEmbeddedKey("CratosProjectId", "Id", true)]
		public DOCratosModuleCollection Modules
		{
			get
			{
				// Determine if we have an object
				if (this.m_ModuleCollection == null) { this.m_ModuleCollection = new DOCratosModuleCollection(); }

				//// Load the embedded object(s) if required
				//if (!this.IsLoading)
				//{
				//  this.LoadEmbeddedCollection("Modules", ((IDOCratosCollection<IDOCratos>)this.m_ModuleCollection));
				//}

				// Return to calling method
				return (this.m_ModuleCollection);
			}
			set { this.m_ModuleCollection = value; this.NotifyPropertyChanged("Modules"); }
		}
		#endregion
		#endregion

		#region Class Methods
		#endregion

		#region Class Support Methods
		#endregion
	}
}
